class_name Player
extends CharacterBody2D

@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D

var direction: Vector2
var mul_direction: Vector2
var face: Vector2 = Vector2.DOWN
@export var speed: float = 400
@export var hold_item: HoldItem = HoldItem.None

static var instance: Player


func _ready() -> void:
	instance = self


func _process(delta: float) -> void:
	GameInputEvents.movement_input()
	direction = GameInputEvents.direction
	mul_direction = GameInputEvents.mul_direction
	if direction != Vector2.ZERO:
		face = direction
	pass


func player_4anim(direction:Vector2, anim_name:String):
	if direction == Vector2.LEFT:
		animated_sprite.play(anim_name+"_left")
	elif direction == Vector2.RIGHT:
		animated_sprite.play(anim_name+"_right")
	elif direction == Vector2.DOWN:
		animated_sprite.play(anim_name+"_front")
	elif direction == Vector2.UP:
		animated_sprite.play(anim_name+"_back")
	pass


static var HoldType: Array[String] = [
	"None", 
	"Axe", 
	"Hoe", 
	"Kettle"
]
enum HoldItem {
	None, 
	Axe, 
	Hoe, 
	Kettle
}
static var HoldItemNames: Dictionary = {
	HoldItem.None: "None",
	HoldItem.Axe: "Axe",
	HoldItem.Hoe: "Hoe",
	HoldItem.Kettle: "Kettle"
}


static func get_instance() -> Player:
	return instance
